package com.sjgtw.cloud.job.task;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.sjgtw.cloud.common.core.domain.R;
import com.sjgtw.cloud.common.core.utils.DateUtils;
import com.sjgtw.cloud.common.core.utils.StringUtils;
import com.sjgtw.cloud.system.api.service.RemoteUserService;

/**
 * <p>Title: 定时任务任务配置单</p>
 * <p>Description: </p>
 *
* @author Admin
 * @date 2020-7-7
 */
@Component("jobTask")
public class JobTask {
	
	/**
	 * <p>Title: jobMultipleParams</p>
	 * <p>Description: 多参数定时任务DEMO</p>
	 * @param s
	 * @param b
	 * @param l
	 * @param d
	 * @param i
	 */
	public void jobMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
	{
	    System.out.println(StringUtils.format("jobMultipleParams 执行时间{}，执行多参方法： 字符串类型{}，布尔类型{}，长整型{}，浮点型{}，整形{}",DateUtils.getTime(), s, b, l, d, i));
	}
	
    
	/**
	 * <p>Title: jobLockUserStatus</p>
	 * <p>Description: 远程调用系统内部API接口服务DEMO</p>
	 * @param l
	 */
	@Resource
	private RemoteUserService remoteUserService;
	
	public void jobLockUserStatus(Long l)
	{
		String sign = "失败";
		R<Integer> luType = remoteUserService.lockUserStatus(l);
		if (StringUtils.isNotNull(luType) && R.FAIL != luType.getCode()
        		&& StringUtils.isNotNull(luType.getData()) && luType.getData() > 0) {
			sign = "成功";
		}
		 System.out.println(StringUtils.format("jobLockUserStatus执行时间{}，执行状态：{}",DateUtils.getTime(), sign));
	}
}
